﻿using System;
using System.Collections.Generic;
using System.Text;

namespace homework3
{
    class triangle : Shape
    {
        private double bottom;//同上
        public double Bottom
        {
            get
            {
                return bottom;
            }
            set
            {
                if (value > 0)
                {
                    bottom = value;
                }
                else
                {
                    bottom = 0;
                }
            }
        }
        private double height;
        public double Height
        {
            get
            {
                return height;
            }
            set
            {
                if (value > 0)
                {
                    height = value;
                }
                else
                {
                    height = 0;
                }
            }
        }

        public triangle(double bottom, double height)
        {
            Bottom = bottom;
            Height = height;
        }

        public override double getArea()
        {
            return bottom * height * 0.5;
        }
    }
}
